function [x,y,typ]=linearBlockEncoder_int(job,arg1,arg2)

x=[];y=[];typ=[]
select job
case 'plot' then
    standard_draw(arg1)
case 'getinputs' then
	[x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
	[x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
	[x,y]=standard_origin(arg1)
case 'set' then
	x=arg1;
	graphics=arg1.graphics;exprs=graphics.exprs
	model=arg1.model;
	x0=model.state
	rpar=model.rpar
	ns=prod(size(x0));nin=1;nout=1
	s=poly(0,'s');z=poly(0,'s')

	while %t do 
      [ok, G, exprs]=getvalue(..
          'Set linear block encoder parameters',..
          ['generator matrix(binary K*N matrix)';
          ],..
          list('mat',[-1 -1]),exprs);
      
      if ~ok then break,end
      
      //N > K, G contains only 0 and 1
      [K, N] = size(G);
      if K >= N
        message("G is K*N matrix, where N > K");
        ok = %f;
      elseif G > 1 | G < 0 
        message("elements of G can only be 0 or 1");
        ok = %f;
      end
    
      if ok then
        graphics.exprs=exprs;
        [model,graphics,ok]=check_io(model,graphics,[K],[N],[],[])
        model.opar=list(G)
        x.graphics=graphics;x.model=model
        break
      end // if ok
	end // while loop
case 'define' then
		N = 7;
		K = 4;
		G = [eye(4,4) [0 1 1; 1 0 1; 1 1 1; 1 1 0] ];
		exprs = ['[eye(4,4) [0 1 1; 1 0 1; 1 1 1; 1 1 0] ] '];
		model = scicos_model()
		model.sim =list('linearBlockEncoder_com', 5)
		model.in = K;
		model.out = N;
		//model.evtin = [1];
		model.dstate = zeros(N, 1);
		model.opar = list(G);
		model.blocktype='d'
		model.dep_ut=[%t %f]

		gr_i=['xstringb(orig(1),orig(2),[''linear block'';''encoder''],sz(1),sz(2),''fill'')']
		x=standard_define([2.5 2.5],model,exprs,gr_i)
end
endfunction
